package com.tjvib.util.retrofit;

import com.tjvib.Constants;

/**
 * 使用：
 * RetrofitHelper.getInstance().create().getVideoList().enqueue(new RetrofitCallback<BaseResponse<List<VideoBean>>>() {
 *
 * @param <T>
 * @Override public void onResponse(Call<BaseResponse<List<VideoBean>>> call, Response<BaseResponse<List<VideoBean>>> response) {
 * <p>
 * }
 * });
 */
public class BaseResponse<T> {

    private int code;
    private T data;
    private String message;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * 判断状态码是否是异常值
     *
     * @return
     */
    public boolean isCodeInvalid() {
        return code != Constants.SUCCESS;
    }
}
